home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 251_01 / advavl.h < prev    next >
Text File  |  1987-10-27  |  896b  |  27 lines

  1. /* avl.h - avl tree definitions */
  2. /*
  3.     Copyright (c) 1986, by David Michael Betz
  4.     All rights reserved
  5. */
  6.  
  7. typedef struct tree {
  8.     struct tnode *tr_root;    /* root node */
  9.     int tr_cnt;            /* count of entries */
  10. } TREE;
  11.  
  12. typedef struct tnode {
  13.     int tn_b;            /* balance flag */
  14.     struct tnode *tn_llink;    /* left subtree */
  15.     struct tnode *tn_rlink;    /* right subtree */
  16.     char *tn_key;        /* word */
  17.     int tn_word;        /* word number */
  18. } TNODE;
  19.  
  20. #define LLINK(n)    ((n)->tn_llink)
  21. #define RLINK(n)    ((n)->tn_rlink)
  22. #define KEY(n)        ((n)->tn_key)
  23. #define WORD(n)        ((n)->tn_word)
  24. #define B(n)        ((n)->tn_b)
  25. #define tentries(t)    ((t)->tr_cnt)
  26. 
  27.